package com.zjitc.controller;

import com.zjitc.model.User;
import com.zjitc.service.UserService;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

/**
 * Create by IntelliJ IDEA
 *
 * @author: jsonor
 * @date-Time: 2018/3/20 14:55
 * @description:
 */
@Controller
public class UserController {

  @Autowired
  private UserService userService;

  @RequestMapping("/findAllUser")
  public ModelAndView findAll() {
    List<User> listUsers = userService.findAll();

    ModelAndView mv = new ModelAndView();
    mv.addObject("users", listUsers);
    mv.setViewName("/WEB-INF/views/users.jsp");

    return mv;
  }
}
